package com.springcloudexample.controller;

import com.springcloudexample.properties.TestProperties;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class HelloController {

    //自动装配注解
    @Autowired
    private TestProperties testProperties;

    @Value("${server.port}")
    private String port;

    @RequestMapping("index")
    public String index(){
        return "Hello World!,版本："+testProperties.getVersion()+",端口："+port;
    }
}
